package com.muyu.payment.domain.model;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.payment.domain.req.PaymentConfigsSaveReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 支付配置保存请求对象
 *
 * @author muyu
 * @date 2025-09-17
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "支付配置保存请求对象")
public class PaymentConfigsSaveModel{


    /**
     * 主键ID
     */
    @Schema(name = "paymentId", title = "主键ID", description = "主键ID" )
    private Long paymentId;

    /**
     * 支付类型(1:微信 2:支付宝 3:其他)
     */
    @Schema(name = "payType", title = "支付类型(1:微信 2:支付宝 3:其他)", description = "支付类型(1:微信 2:支付宝 3:其他)" , required = true)
    private Long payType;

    /**
     * 应用ID
     */
    @Schema(name = "appId", title = "应用ID", description = "应用ID" , required = true)
    private String appId;

    /**
     * 商户号
     */
    @Schema(name = "merchantId", title = "商户号", description = "商户号" , required = true)
    private String merchantId;

    /**
     * 商户私钥
     */
    @Schema(name = "privateKey", title = "商户私钥", description = "商户私钥" , required = true)
    private String privateKey;

    /**
     * 平台公钥
     */
    @Schema(name = "publicKey", title = "平台公钥", description = "平台公钥" )
    private String publicKey;

    /**
     * 支付结果回调地址
     */
    @Schema(name = "callbackUrl", title = "支付结果回调地址", description = "支付结果回调地址" , required = true)
    private String callbackUrl;

    /**
     * 配置名称
     */
    @Schema(name = "configName", title = "配置名称", description = "配置名称" , required = true)
    private String configName;

    /**
     * 是否沙箱环境(0:正式环境 1:沙箱环境)
     */
    @Schema(name = "isSandbox", title = "是否沙箱环境(0:正式环境 1:沙箱环境)", description = "是否沙箱环境(0:正式环境 1:沙箱环境)" , required = true)
    private String isSandbox;

    /**
     * 状态(0:禁用 1:启用)
     */
    @Schema(name = "status", title = "状态(0:禁用 1:启用)", description = "状态(0:禁用 1:启用)" , required = true)
    private String status;

    /**
     * 删除标志（0-未删除，1-已删除）
     */
    @Schema(name = "deleted", title = "删除标志（0-未删除，1-已删除）", description = "删除标志（0-未删除，1-已删除）" )
    private Integer deleted;


    /**
     * 修改构造器
     */
    public static PaymentConfigsSaveModel saveReqBuild(PaymentConfigsSaveReq saveReq){
        return PaymentConfigsSaveModel.builder()
            .payType(saveReq.getPayType())
            .appId(saveReq.getAppId())
            .merchantId(saveReq.getMerchantId())
            .privateKey(saveReq.getPrivateKey())
            .publicKey(saveReq.getPublicKey())
            .callbackUrl(saveReq.getCallbackUrl())
            .configName(saveReq.getConfigName())
            .isSandbox(saveReq.getIsSandbox())
            .status(saveReq.getStatus())
            .build();
    }

}
